package xianchenganquan;

public class RunnerableImpl implements Runnable{
    private  int tick =100;
    Object obj = new Object();
    @Override
    public void   run() {
       while (true){
           synchronized (obj){
               if (tick>0) {
                   try {
                       Thread.sleep(10);
                   } catch (InterruptedException e) {
                       e.printStackTrace();
                   }
                   tick --;
                   System.out.println(Thread.currentThread().getName()+"变量"+tick);
               }
           }
       }
    }
}
